﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WCFClientConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            using (ServiceReference1.Service1Client client = new ServiceReference1.Service1Client())
            {
                client.ClientCredentials.UserName.UserName = "mina";
                client.ClientCredentials.UserName.Password = "Kalama#a";

                try
                {

                    //Console.WriteLine("GetLast24Observations ");
                    //client.GetLast24Observations().ForEach(x =>
                    //{
                    //    Console.WriteLine();
                    //    Console.WriteLine("Time: " + x.Timestamp);
                    //    x.StationObservations.ForEach(z =>
                    //    {
                    //        Console.Write("Station: " + z.StationName);
                    //        Console.WriteLine(" Airtemp: " + z.AirTemperature);
                    //    });

                    //});

                    //Console.WriteLine();
                    //Console.WriteLine("Get given station data: ");
                    //client.GetStationObservations(2, 2).ForEach(x =>
                    //{
                    //   Console.Write("Station: "+ x.StationName);
                    //    Console.Write(" Phenomenon: "+x.Phenomenon);
                    //    Console.WriteLine(" Air pressure: "+x.AirPressure);

                    //});
                    //Console.WriteLine();
                    //Console.WriteLine("The warmest Station at the moment: "+client.GetWarmest().Name);
                    //Console.WriteLine();
                    //Console.WriteLine("Stations with lower than 7 degrees: ");
                    //client.GetStationsWhereLower(7.0).ForEach(x =>
                    //{
                    //    Console.WriteLine(x.Name);
                    //});
                    //Console.WriteLine();
                    //Console.WriteLine("Stations with higher than 7 degrees: ");

                    //client.GetStationsWhereHigherOrEqual(7.0).ForEach(x =>
                    //{
                    //    Console.WriteLine(x.Name);
                    //});

                    //DateTime begin = DateTime.Parse("2012-05-24 15:27:00");
                    //DateTime end = DateTime.Parse("2012-05-29 02:54:00");
                    //Console.WriteLine();
                    
                    //Console.WriteLine("The sum of Percipitations in Tallinn (Harku) "+client.GetPercipitationsSum(begin, end, "Tallinn (Harku)"));

                    //client.Close();

                }
                catch (Exception e)
                {
                    Console.WriteLine("Tere talv! " + e.ToString());
                }
            }
            Console.ReadLine();
        }
    }
}
